package cn.com.cennavi.bean;

import java.util.ArrayList;
import java.util.Collections;

public class TestBean implements Comparable<TestBean> {
	private Long time;
	private String carId;

	public Long getTime() {
		return this.time;
	}

	public String getcarId() {
		return this.carId;
	}

	public void settime(Long time) {
		this.time = time;
	}

	public void setcarId(String carID) {
		this.carId = carID;
	}

	@Override
	public int compareTo(TestBean arg0) {
		// TODO Auto-generated method stub
		return this.time.compareTo(arg0.getTime());
	}

	public static void main(String[] args) {
		ArrayList<TestBean>dd=new ArrayList<TestBean>();
		TestBean s1=new TestBean();
		s1.setcarId("3");
		s1.settime(333l);
		TestBean s2=new TestBean();
		s2.setcarId("1");
		s2.settime(111l);
		TestBean s3=new TestBean();
		s3.setcarId("2");
		s3.settime(222l);
		dd.add(s1);
		dd.add(s2);
		dd.add(s3);
		Collections.sort(dd);
		for(TestBean s:dd){
			System.out.println(s.getTime());
		}
	}
}
